home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F40126_improvedDiffList.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-02-06  |  3.2 KB  |  86 lines

  1. <xsl:stylesheet version="1.0" 
  2. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xalan="http://xml.apache.org/xalan"
  4. xmlns:myImproveGenerator="myImproveGenerator"
  5. xmlns:myImproveController="myImproveController" 
  6. exclude-result-prefixes="xsl xalan myImproveGenerator myImproveController"
  7. >
  8.   <xsl:import href="improve.xsl"/>
  9.   <xsl:import href="take.xsl"/> 
  10.   <xsl:import href="takeWhile.xsl"/> 
  11.   <xsl:import href="easyDiffList.xsl"/>
  12.  
  13.   <myImproveGenerator:myImproveGenerator/>
  14.   <myImproveController:myImproveController/>
  15.   
  16.   <xsl:output indent="yes" omit-xml-declaration="yes"/>
  17.   
  18.   <xsl:template name="improvedDiffList">
  19.     <xsl:param name="pFun" select="/.."/>
  20.     <xsl:param name="pX"/>
  21.     <xsl:param name="pH0" select="0.1"/>
  22.     <xsl:param name="pEpsRough" select="0.0001"/>
  23.     <xsl:param name="pEpsImproved" select="0.0000001"/>
  24.  
  25.      <xsl:variable name="vMyImproveGenerator" select="document('')/*/myImproveGenerator:*[1]"/>
  26.      <xsl:variable name="vMyImproveController" select="document('')/*/myImproveController:*[1]"/>
  27.      
  28.      <xsl:variable name="vrtfRoughResults">
  29.         <xsl:call-template name="easyDiffList">
  30.             <xsl:with-param name="pFun" select="$pFun"/>
  31.             <xsl:with-param name="pX" select="$pX"/>
  32.             <xsl:with-param name="pH0" select="$pH0"/>
  33.             <xsl:with-param name="pEps" select="$pEpsRough"/>
  34.         </xsl:call-template>
  35.      </xsl:variable>
  36.  
  37.     <xsl:variable name="vrtfResults">
  38.         <xsl:call-template name="takeWhile">
  39.           <xsl:with-param name="pGenerator" select="$vMyImproveGenerator"/>
  40.           <xsl:with-param name="pParam0" select="xalan:nodeset($vrtfRoughResults)/*"/>
  41.           <xsl:with-param name="pController" select="$vMyImproveController"/>
  42.           <xsl:with-param name="pContollerParam" select="$pEpsImproved"/>
  43.         </xsl:call-template>
  44.     </xsl:variable>
  45.     
  46.     <xsl:copy-of select="xalan:nodeset($vrtfResults)/*"/>
  47.     
  48.   </xsl:template>
  49.   
  50.   <xsl:template name="myImproveGenerator" match="*[namespace-uri()='myImproveGenerator']">
  51.      <xsl:param name="pList" select="/.."/>
  52.      <xsl:param name="pParams" select="/.."/>
  53.      
  54.      <xsl:choose>
  55.        <xsl:when test="not($pList)">
  56.          <xsl:call-template name="improve">
  57.             <xsl:with-param name="pList" select="$pParams"/>
  58.          </xsl:call-template>
  59.        </xsl:when>
  60.        <xsl:otherwise>
  61.          <xsl:call-template name="improve">
  62.             <xsl:with-param name="pList" select="$pList[last()]/*"/>
  63.          </xsl:call-template>
  64.        </xsl:otherwise>
  65.      </xsl:choose>
  66.  
  67.   </xsl:template>
  68.   
  69.   <xsl:template name="MyImproveController" match="*[namespace-uri()='myImproveController']">
  70.     <xsl:param name="pList" select="/.."/>
  71.     <xsl:param name="pParams" select="0.01"/>
  72.     
  73.     <xsl:choose>
  74.       <xsl:when test="count($pList) < 2">1</xsl:when>
  75.       <xsl:otherwise>
  76.         <xsl:variable name="vDiff" select="$pList[last()]/*[2] 
  77.                                           - $pList[last() - 1]/*[2]"/>
  78.         <xsl:if test="not($vDiff < $pParams 
  79.                      and $vDiff > (0 - $pParams))
  80.                      and count($pList) <= 5
  81.                      ">1</xsl:if>
  82.       </xsl:otherwise>
  83.     </xsl:choose>
  84.   
  85.   </xsl:template>
  86. </xsl:stylesheet>